package com.github.binarywang.demo.wechat.shiro;

import java.util.Date;

import org.apache.shiro.authc.AuthenticationToken;
import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 用户保存和生成前台使用的Token数据
 * 
 * @author Victor
 * @Date 2018年1月17日
 */
public class JwtUser implements AuthenticationToken {
	private static final long serialVersionUID = 1L;
	private Long id;
	private String username;
	private String email;
	private String mobile;
	private Long employeeId;
	private String digest;// 消息摘要，token串
	// private final Collection<? extends GrantedAuthority> authorities;
	// private final boolean enabled;
	private Date lastPasswordResetDate;

	public JwtUser(Long id, String username, String email, String mobile, Long employeeId, Date lastPasswordResetDate// ,
	// Collection<? extends GrantedAuthority> authorities, boolean enabled,
	) {
		this.id = id;
		this.username = username;
		this.email = email;
		this.mobile = mobile;
		this.employeeId = employeeId;
		// this.authorities = authorities;
		// this.enabled = enabled;
		this.lastPasswordResetDate = lastPasswordResetDate;
	}

	public JwtUser(String username, String digest) {
		this.username = username;
		this.digest = digest;
	}

	public String getDigest() {
		return digest;
	}

	public void setDigest(String digest) {
		this.digest = digest;
	}

	public String getEmail() {
		return email;
	}

	@JsonIgnore
	public Long getId() {
		return id;
	}

	public String getMobile() {
		return mobile;
	}

	public Date getLastPasswordResetDate() {
		return lastPasswordResetDate;
	}

	public String getUsername() {
		return username;
	}

	public Object getPrincipal() {
		return username;
	}

	public Object getCredentials() {
		return digest;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public Long getEmployeeId() {
		return employeeId;
	}

}
